import Vue from 'vue'
Vue.prototype.saveToStorage = (key,data) => {
	return new Promise((resolve, reject)=>{
		uni.setStorage({
			key,
			// data:JSON.stringify(data),
			data,
			success:result=>{
				console.log("存储数据成功:",key)
				resolve(result)
			},
			fail:err=>{
				reject(err.toString())
			}
		})
	})
}
Vue.prototype.getStorage = (key) => {
	return new Promise((resolve, reject)=>{
		uni.getStorage({
			key,
			success:result=>{
				console.log("获取数据:",key)
				// resolve(JSON.parse(result))
				resolve(result)
			},
			fail:err=>{
				reject("获取数据失败")
			}
		})
	})
}